<template>
  <div>
    <el-drawer
      :title="dataTitle"
      :visible.sync="drawer"
      :direction="direction"
      modal
      >
      <data-form v-bind:sendOneToForm = sendOneToDrawer v-bind:is-changeable = flag>

      </data-form>
    </el-drawer>
  </div>
</template>

<script>

  import DataForm from "./DataForm";

  export default {
    name: "Drawer",
    components: {
      DataForm
    },
    data() {
      return {
        dataTitle: '查看详情',
        drawer: false,
        direction: 'rtl',
        sendOneToForm : this.sendOneToDrawer,
        flag:true,
        isChangeable: true
      };
    },
    watch:{
      want:function (val) {
        this.drawer = true;
        if (val === "create"){
          this.flag = false;
        }else if (val === "check"){
        }else if (val === "update"){
          this.flag = false;
        }else {
          this.drawer = false;
          alert("异常")
        }
      }
    },
    props:{
      sendOneToDrawer:{
        type: Object,
        default : null,
        required: false
      },
      want:{
        type: String,
        default:"",
        required: true
      }
    }
  }
</script>

<style scoped>

</style>
